using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Globalization;

using ROC.Resources.Library.Data.SQL2005;

namespace MoneyManagerPro.Resources.Repository.Users
{
    internal class UserDeleteFactory : IDeleteFactory<System.Int32>
    {
        public UserDeleteFactory()
        {
        }


        #region IDeleteFactory<int> Members

        public SqlCommand ConstructDeleteCommand(SqlDatabase db, int id)
        {
            SqlCommand command = db.GetStoredProcCommand("DeleteUser");

            db.AddInParameter(command, "Id", SqlDbType.Int, id);

            return command;
        }

        #endregion

        #region IDbToBusinessEntityNameMapper Members

        public string MapDbParameterToBusinessEntityProperty(string dbParameter)
        {
            switch (dbParameter)
            {
                case "Id":
                    return dbParameter;
                default:
                    throw new System.ArgumentException(string.Format(CultureInfo.CurrentCulture, ROC.Resources.Library.Data.Generic.GenericResources.InvalidParameterName), dbParameter);
            }
        }

        #endregion
    }
}
